#pragma once
#include <pthread.h>

namespace zty
{
    class lock_guard
    {
        pthread_mutex_t &_pmtx;

    public:
        lock_guard(pthread_mutex_t &pmtx)
            : _pmtx(pmtx)
        {
            pthread_mutex_lock(&_pmtx);
        }
        ~lock_guard()
        {
            pthread_mutex_unlock(&_pmtx);
        }
    };
}